package two.chapter_1.c1_2;

import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;

public class Flips {
    /**
     * 模拟掷硬币
     * @param args
     */
    public static void main(String [] args){

        int T= 100000000;
        Counter heads=new Counter("heads");
        Counter tails=new Counter("tails");

        for (int i=0;i<T;i++){
            if (StdRandom.bernoulli(0.5)){
                heads.increment();
            }else {
                tails.increment();
            }
        }
        StdOut.println(heads);
        StdOut.println(tails);
    }
}
